Skip to content

Conversation

@davidbarsky
Copy link

Just a thing that was discussed in Discord.

As an aside—if it's useful—I've found that the experience of developing a Rust codebase with support for different with FFI'd targets is to have a Rust code and a crate for each language you're binding to. If you'd like, I'd be happy to send over a PR with those changes. It'll mean you'd probably be able to get rid of the #![allow(dead_code)]/#![allow(unused_imports)] and get the non-additive feature flags—rust-analyzer will probably work better as well.

(Of course, if you don't want a random-drive-by refactoring, that's also fine too! I can imagine that'd be pretty annoying.)

Comment on lines +404 to +409
let level = match _level {
0 => tracing::Level::TRACE,
1 => tracing::Level::DEBUG,
2 => tracing::Level::INFO,
3 => tracing::Level::WARN,
4 => tracing::Level::ERROR,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this the opposite of what's happening inside of the (since-deleted) logging.rs—both log and tracing treat the most verbose level as the lowest usize, but logging did the opposite (0 is ERROR).

I put up this PR as-is since I'm not sure what the usage of this is over on d2foundry (and since log/tracing have one more logging level than D2_Calculation_API, starting at 0 would result in an off-by-one-error semantic error anyways).

In any case, I'm happy to change this section however you'd like me to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant